
const baseURL = 'http://localhost:3000'

const request = ({ url, path = '', params = {}, data = {}, methods = "GET", ...rest }) => {
    return new Promise((resolve, reject) => {
        return wx.request({
            url: url || baseURL + path,
            data: {
                ...params,
                ...data
            },
            method: methods,
            header:{
                cookie: wx.getStorageSync('cookie')
            },
            success: (res) => {
                resolve(res && res.data)
            },
            fail: (err) => {
                reject(err)
            }
        })
    })
}

export default request